
             
/**
 * 
 *
 * Copyright (c) 2012-2013 JLLT Corp. 2012-2013,All Rights Reserved.
 * This software is published under the 金麟龙腾商贸有限公司.
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file. 
 *
 * @File name:  TOfferProductDao.java 
 * @Create on:  2012-07-16 20:23:762
 * @Author      :  高宇舟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        package com.boho.ecp.product.dao;

            
import java.sql.Connection;
import java.util.List;

import cn.boho.framework.po.CQuery;
import cn.boho.framework.po.CQueryFactoryTool;
import cn.boho.framework.po.DAO;
            
        /**
 * 【特价商品信息:T_OFFER_PRODUCT】的Dao操作类
 * 
 */
public class TOfferProductDao extends DAO {
	/**
	* 根据条件查询【特价商品信息:T_OFFER_PRODUCT|】信息
	* @param con
	* @param offerType 特价类型
	* @param isValid 是否有效
	* @return
	* @throws Exception
	* @date2012-07-16
	* @author 高宇舟
	* 
	*/
	public static List queryTOfferProductByCondition(Connection con,java.lang.String offerType,java.lang.Integer isValid)throws Exception{
		StringBuffer sql = new StringBuffer();
		sql.append("select OP.PRODUCT_ID,P.PRODUCT_NO,P.PRODUCT_NAME,P.MARKET_PRICE,P.PHOTO_URL,OP.OFFER_PRICE,OP.OFFER_PRODUCT_ID,OP.START_DATE,OP.END_DATE,OP.OFFER_TYPE from T_OFFER_PRODUCT OP");
		sql.append(" left join T_PRODUCT P ON P.PRODUCT_ID = OP.PRODUCT_ID");
		sql.append(" WHERE OP.OFFER_TYPE = ?");
//		sql.append(" AND OP.START_DATE <= sysdate()");
//		sql.append(" AND OP.END_DATE >= sysdate()");
		sql.append(" AND OP.IS_VALID = ?");
		
		CQuery query = CQueryFactoryTool.createFactory().createCQuery();
 		query.setCommand(sql.toString());
 		query.setString(1, offerType);
 		query.setInt(2, isValid);
 		logger.debug("TOfferProductDao.queryTOfferProductByCondition() SQL->"+sql.toString());
 		return query.getDynaBeanMapList("T_OFFER_PRODUCT", con);
	}
}
